Extension of Iterator Traits in the C++ Standard Template Library
نویسندگان
چکیده
The C++ Standard Template Library is the flagship example for libraries based on the generic programming paradigm. The usage of this library is intended to minimize classical C/C++ error, but does not warrant bug-free programs. Furthermore, many new kinds of errors may arise from the inaccurate use of the generic programming paradigm, like dereferencing invalid iterators or misunderstanding remove-like algorithms. In this paper we present typical scenarios, that can cause runtime problems. We emit warnings while these constructs are used without any modification in the compiler. We argue for an extension of the STL’s iterator traits in order to emit these warnings. We also present a general approach to emit “customized” warnings. We support the so-called believe-me marks to disable warnings.
منابع مشابه
Programming with the HPC++ Parallel Standard Template Library
We present an overview of the HPC++ Parallel Standard Template Library (PSTL), a parallel version of the C++ Standard Template Library (STL). The PSTL is part of HPC++, a C++ library and language extension framework being developed by the HPC++ consortium as a standard model for portable parallel programming in C++. The PSTL includes distributed versions of the seven STL containers (vector, lis...
متن کاملStronger guarantees for standard-library containers
The Standard Template Library (STL) [13, 14] is a library of generic algorithms and data structures that has been incorporated in the C++ standard [1] and ships with all modern C++ compilers. In the CPH STL project [4] our goal is to implement an enhanced edition of the STL. Initially, our focus was on time and space efficiency of the STL components, but now we are also focusing on safety, reli...
متن کاملSafe Iterator Framework for the C++ Standard Template Library
The C++ Standard Template Library is the flagship example for libraries based on the generic programming paradigm. The usage of this library is intended to minimize classical C/C++ errors, but does not warrant bug-free programs. Furthermore, many new kinds of errors may arise from the inaccurate use of the generic programming paradigm, like dereferencing invalid iterators or misunderstanding re...
متن کاملMeasuring the Overhead of C++ Standard Template Library Safe Variants
The C++ Standard Template Library is a widely-used library that is based on the generic programming paradigm. The usage of this library does not warrant bug-free programs. Furthermore, many new errors may arise from the inaccurate use of the generic programming paradigm, like dereferencing invalid iterators or misunderstanding remove-like algorithms. Most of the STL algorithms have precondition...
متن کاملGeneric Components for Petascale Adaptive Unstructured Mesh Simulations
In the traditional programming paradigm, data structures and algorithms are developed for specific data types and requirements. This leads to code redundancy and inflexibility thus not allowing effective code reuse for similar applications. One effective approach to increase code reuse is generic programming, which focuses on the development of efficient, reusable software libraries through sui...
متن کامل